package com.sip.stream.utils.zfy.holder;

import android.graphics.Color;
import android.view.View;

import com.sip.stream.ClientApp;
import com.sip.stream.R;
import com.sip.stream.databinding.ViewholderStatusGpsBinding;
import com.sip.stream.utils.zfy.adapter.BaseDataBindingViewHolder;
import com.sip.stream.utils.zfy.listener.DataBindingViewHolderClickListener;
import com.sip.stream.utils.zfy.status.ZFYStatus;

public class ZFYStatusGPSViewHolder extends BaseDataBindingViewHolder<ViewholderStatusGpsBinding, String> {
    public ZFYStatusGPSViewHolder(ViewholderStatusGpsBinding viewholderStatusGpsBinding, DataBindingViewHolderClickListener<String> dataBindingViewHolderClickListener) {
        super(viewholderStatusGpsBinding, dataBindingViewHolderClickListener);
    }

    @Override
    public void onBindViewHolder(int i, String str) {
        super.onBindViewHolder(i, str);
        if (!ZFYStatus.getInstance().isGpsReady()) {
            this.binding.tvMessage.setVisibility(View.GONE);
            this.binding.ivContent.setVisibility(View.GONE);
            return;
        }
        this.binding.tvMessage.setVisibility(View.VISIBLE);
        if (ZFYStatus.getInstance().isBdOnly()) {
            this.binding.ivContent.setVisibility(View.VISIBLE);
            this.binding.tvMessage.setText("北");
        } else {
            this.binding.tvMessage.setVisibility(View.GONE);
        }
        if (System.currentTimeMillis() - ZFYStatus.getInstance().getLocation().getLocationTime() > 60000) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.ic_vector_gps_n));
            this.binding.tvMessage.setTextColor(Color.parseColor("#FFFFFF"));
            return;
        }
        this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.ic_vector_gps_h));
        this.binding.tvMessage.setTextColor(Color.parseColor("#5FC25F"));
    }
}
